Using the sample PowerShell scripts

The sample PowerShell scripts that are provided in this SDK are intended only to help you get started. They are not intended to provide a complete web services client that you can use out of the box. They are located in the following folder:

Symantec Endpoint Protection Installation file\Tools\Integration\SEPM_WebService_SDK\SampleCode\PowerShell\

Prerequisites

Note:

These scripts are not signed. To run them, you must enable unsigned scripts.

If you run the scripts against a remote Symantec Endpoint Protection Manager server, edit the configuration file (config.xml) to provide the hostname and web services port of the Symantec Endpoint Protection Manager instance. If you run the scripts locally, and if you installed Symantec Endpoint Protection Manager with the default values, you can skip this step.

If you run the scripts against a remote Symantec Endpoint Protection Manager server, you must also edit the WSDL files to provide the hostname and web services port of the Symantec Endpoint Protection Manager instance. See Static WSDL files.

Edit the configuration file (config.xml) to replace the example client ID and client secret with the values that you obtained. This file is parsed by all the other sample scripts. If you encounter problems with your web services connection or with authentication, check this file first to make sure that you have the correct values.

Note:

If you encounter persistent errors with the scripts that get the access token, you can work around the issue by obtaining the token directly through browser calls. You must use Chrome, Firefox, or Internet Explorer 9 or later. This issue exists on the server, not in the PowerShell scripts.

See Authorizing an application to call Symantec Endpoint Protection Manager web services.

See Getting an OAuth access token from the authorization code.

Note:

These scripts explicitly ignore certificate errors. Your web service client application should properly install the self-signed certificate that Symantec Endpoint Protection Manager requires.

Table: PowerShell scripts

File name

Description

Notes

Write-AccessTokenToConfig.ps1

Provides an example of how to obtains an OAuth access token for a web services client application, and writes the token to Config.xml.

Run this script first to obtain the access token that is required by all web service calls.

See Using OAuth with Symantec Endpoint Protection Manager web services.

GetSepmRmmWsAccessToken.ps1

Provides an example of how to obtain an OAuth access token manually for a web services client application

We recommend that you use Write-AccessTokenToConfig.ps1. If you run GetSepmRmmWsAccessToken.ps1, you must manually add the access token to Config.xml.

Get-SepmRmmWebService.ps1

Provides an example of how to create a PowerShell interface for the web services

 

ConvertFrom-JSON.ps1

Provides an example of how to convert a JSON object to a PowerShell object

Note:

Called by GetSepmRmmWsAccessToken.ps1

Access tokens are provided as JSON objects.

See Getting an OAuth access token from the authorization code.

ClientServiceTest.ps1

Provides an example of how to obtain lists of Symantec Endpoint Protection clients or groups of clients

The client lists that are provided by the ClientService web service are used as input parameters to the methods of the CommandService web service.

Group IDs are used as input parameters to the methods of the PolicyService web service.

CommandServiceTest.ps1

Provides an example of how to send commands to a list of clients or groups and get the status of the command that was sent

See Running commands on clients.

LicenseServiceTest.ps1

Provides an example of how to retrieve the status of license information

See License reporting.

LiveUpdateServiceTest.ps1

Provides an example of how to run LiveUpdate and get the status of LiveUpdate content on the Symantec Endpoint Protection Manager server

See Running LiveUpdate on the server.

See Checking content from LiveUpdate on the server.

PolicyServiceTest.ps1

Provides information about how to assign policies to lists of client groups

See Assigning policies to clients.

For more information about the methods that are provided by each web service, see the Reference Guide.

See Constructing a web services client application from the WSDL files.

See Creating a web services client application.